package com.Earth01;
/*
* 206. 反转链表
* 不太熟练
* */
public class Earth240718 {
    /**
     * Definition for singly-linked list.
     * public class ListNode {
     *     int val;
     *     ListNode next;
     *     ListNode() {}
     *     ListNode(int val) { this.val = val; }
     *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
     * }
     */
    public static void main(String[] args) {

    }
    public static ListNode reverseList(ListNode head) {
        ListNode tempNode = head;
        ListNode resNode = null;

        while(tempNode != null){
            ListNode next = tempNode.next;
            tempNode.next = resNode;
            resNode = tempNode;
            tempNode = next;
        }
        return resNode;
    }
}
